package day8.homeworkII;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class Task4 {
    public static void main(String[] args) throws IOException {

        System.out.println("请输入你要输入的内容：");
        System.err.println("注意:输入886为退出");
        Scanner in = new Scanner(System.in);

        File f = new File("E:\\GZ2148班上课资料\\Info.txt");

        String line = "";

        try(Writer w = new FileWriter(f);) {
            while (!line.equals("886")) {
                line = in.nextLine();
                w.write(line);
                w.write("\n");
                w.flush();
            }
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
